package com.me.jingdongshop.model.bean.error;

/**
 * Created by YL on 2017/5/4.
 */

public enum ErrorCode {
    ERROR0(0,"用户名不存在或密码错误"),
    ERROR1(1,"userid请求头为空"),
    ERROR2(2,"该用户名已经被注册过了"),
    ERROR3(3,"没有登录或则需要重新登录"),
    ERROR4(4,"请求参数错误或缺失"),
    ERROR5(5," 当前商品已经添加过收藏"),
    ERROR6(6," 商品已经添加收藏失败"),
    ERROR7(7," 取消订单失败"),
    ERROR8(8,"  没有该订单详情");
    //错误码
    private int code;
    //错误码详情
    private String des;

    ErrorCode(int code,String des) {
        this.code = code;
        this.des = des;
    }
    //根据错误码获取错误详情
    public static String getOrderDes(int status) {
        switch (status) {
            case 0:
                return ERROR0.des;
            case 1:
                return ERROR1.des;
            case 2:
                return ERROR2.des;
            case 3:
                return ERROR3.des;
            case 4:
                return ERROR4.des;
            case 5:
                return ERROR5.des;
            case 6:
                return ERROR6.des;
            case 7:
                return ERROR7.des;
            case 8:
                return ERROR8.des;
        }
        return ERROR0.des;
    }
}
